package daobeauty.util;

import java.util.Collections;
import java.util.Iterator;
import java.util.NoSuchElementException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Created 15.09.2008
 * @author M. Serhat Cinar
 *
 */
public class EmptyStack<O> implements Stack<O> {
	@SuppressWarnings("unused")
	private static final Log LOG = LogFactory.getLog(EmptyStack.class);
	
	public static final EmptyStack INSTANCE = new EmptyStack();
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#push(O)
	 */
	public void push(O element){}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#pop()
	 */
	public O pop(){
		throw new NoSuchElementException();
	}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#peek()
	 */
	public O peek(){
		throw new NoSuchElementException();
	}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#isEmpty()
	 */
	public boolean isEmpty(){
		return true;
	}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#addFirst(O)
	 */
	public void addFirst(O element){}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#size()
	 */
	public int size(){
		return 0;
	}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#iterator()
	 */
	@SuppressWarnings("unchecked")
	public Iterator<O> iterator(){
		return Collections.EMPTY_LIST.iterator();
	}
	
	/* (non-Javadoc)
	 * @see daobeauty.util.Stack#toString()
	 */
	public String toString(){
		return "{}";
	}
}
